@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @component('backend::component.form.form')
        @slot('form_title') {{$page_title}} @endslot
        @slot('formId') shop-rule @endslot
        @slot('action') {{route('b_ShopRule_update')}} @endslot
        <div class="form-group">
            <div class="rule-column">
                <div class="rule-title"><span>厂价提货区规则</span></div>
                <div class="rule-content">
                    <p>
                        <span>厂价提货区开发时间为</span>
                        <input type="text" name="th_open_time[]"
                               value="{{$rule->th_open_time[0]}}"
                               class="form-control d-inline range-time ipt-md" >
                        <span>和</span>
                        <input type="text" name="th_open_time[]"
                               value="{{$rule->th_open_time[1]}}"
                               class="form-control d-inline range-time ipt-md" >
                    </p>
                    <p>
                        <span>进入厂价提货区需</span>
                        <input type="text" name="th_need_credit"   value="{{$rule->th_need_credit ?? 0}}"
                               class="form-control d-inline ipt-xs" >
                        <span>的信誉积分</span>
                    </p>
                    <p>
                        <span>厂价提货是否开发</span>
                        @foreach([1=>'开放',0=>'关闭'] as $key=>$item)
                            @component('backend::component.radio')
                                @slot('name') th_is_open @endslot
                                @slot('title') {{$item}} @endslot
                                @slot('value') {{$key}} @endslot
                                @slot('checked')
                                      @if($key== ($rule->th_is_open??1)) checked @endif
                                @endslot
                            @endcomponent
                        @endforeach
                    </p>
                </div>
            </div>
            <div class="rule-column">
                <div class="rule-title"><span>消费积分</span></div>
                <div class="rule-content">
                    <p>
                        <span>自营和托管回款的</span>
                        <input type="text" name="consume_score_ratio"
                               value="{{$rule->consume_score_ratio ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>%为消费积分</span>
                    </p>
                </div>
            </div>
            <div class="rule-column">
                <div class="rule-title"><span>托管规则</span></div>
                <div class="rule-content">
                    <p>
                        <span>用户选择托管会收取</span>
                        <input type="text" name="trusteeship_tax_ratio"
                               value="{{$rule->trusteeship_tax_ratio ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>%的税,</span>
                        <input type="text" name="trusteeship_service_ratio"
                               value="{{$rule->trusteeship_service_ratio ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>%的服务费</span>
                    </p>
                    <p>
                        <span>用户选择托管后</span>
                        <input type="text" name="trusteeship_day"
                               value="{{$rule->trusteeship_day ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>工作日后汇款</span>
                    </p>
                </div>
            </div>
            <div class="rule-column">
                <div class="rule-title"><span>自营规则</span></div>
                <div class="rule-content">
                    <p>
                        <span>用户选择自营成交后收取</span>
                        <input type="text" name="entrust_tax_ratio"
                               value="{{$rule->entrust_tax_ratio ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>%的税</span>
                    </p>
                </div>
            </div>
           {{-- <div class="rule-column">
                <div class="rule-title"><span>签到规则</span></div>
                <div class="rule-content">
                    <p>
                        <span>每天签到送</span>
                        <input type="text" name="sign_in_send_credit"
                               value="{{$rule->sign_in_send_credit ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>个信誉积分,连续签到</span>
                        <input type="text" name="sign_in_keep_day"
                               value="{{$rule->sign_in_keep_day ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>天,送</span>
                        <input type="text" name="sign_in_keep_credit"
                               value="{{$rule->sign_in_keep_credit??0}}"
                               class="form-control d-inline ipt-min" />
                        <span>个信誉积分</span>
                    </p>
                </div>
            </div>--}}
            <div class="rule-column">
                <div class="rule-title"><span>充值规则</span></div>
                <div class="rule-content">
                    <p>
                        <span>每周最多充值</span>
                        <input type="text" name="rg_max"
                               value="{{$rule->rg_max ?? 0}}"
                               class="form-control d-inline ipt-min" />
                        <span>元</span>
                    </p>
                </div>
            </div>
        </div>
        @slot('buttons')
            @component('backend::component.form.button')
                @slot('title') 提交 @endslot
                @slot('size') sm @endslot
                @slot('color') danger @endslot
                @slot('attr') style=margin-left:150px; @endslot
                @slot('params') {"formId":"#shop-rule"} @endslot
                @slot('class') btn-min-width ajax-form @endslot
            @endcomponent
        @endslot
    @endcomponent
@endsection
@push('scripts')
<script>
    layui.use(['jquery','layer','laydate'], function(){
        var $ = layui.jquery;
        var layer = layui.layer;
        var laydate = layui.laydate;
        $('.range-time').each(function () {
            var targetElem = $(this);
            var defaultVal = $(this).val();
            laydate.render({
                elem:targetElem[0]
                ,type: 'time'
                 ,value:defaultVal
                ,range: true //或 range: '~' 来自定义分割字符
            });
        })


    });
</script>
@endpush